package cn.bluethink.eguan.result;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 返回结果
 * 
 * @title 苏州中科蓝迪公司所有(c)2016-2021
 * @version 0.1.0
 * @describe 
 * @author liuxn
 * @date  2018年8月16日
 */
public class ResponseResult<T> implements Serializable {

	private static final long serialVersionUID = 2719931935414658118L;

	private int status;
	
	private String message;
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private final Date timestamp;
	
    private T data;

	private String[] exceptions;

	public ResponseResult(int status, String message) {
		this.status = status;
		this.message = message;
		this.timestamp = new Date();
	}

	public ResponseResult(int status, String message, T data) {
		this(status, message);
		this.data = data;
	}

	public ResponseResult(int status, String message, String[] exceptions) {
		this(status, message);
		this.exceptions = exceptions;
	}

    public ResponseResult(ResponseMessage responseMessage) {
		this(responseMessage.getStatus(), responseMessage.getMessage());
	}
    
	public ResponseResult(ResponseMessage responseMessage, T data) {
		this(responseMessage);
		this.data = data;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Date getTimestamp() {
		return timestamp;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}

	public String[] getExceptions() {
		return exceptions;
	}

	public void setExceptions(String[] exceptions) {
		this.exceptions = exceptions;
	}
}
